package newWork.controller;

import newWork.constant.ResultConstant;
import newWork.entity.CommonResult;
import newWork.entity.SalaryEntity;
import newWork.service.ISalaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/salary")
public class SalaryController {


	@Autowired
	private ISalaryService service;

	
	/**
	 * 查询
	 *
	 * @return
	 */
	@RequestMapping(value = "/select", method = RequestMethod.POST)
	public CommonResult select(@RequestBody SalaryEntity entity) {
		return new CommonResult(ResultConstant.SUCCCSS_CODE, ResultConstant.SUCCESS_MSG, service.select(entity));
	}



	/**
	 * 更新
	 *
	 * @return
	 */
	@RequestMapping(value = "/update", method = RequestMethod.POST)
	public CommonResult update(@RequestBody SalaryEntity entity) {
		service.update(entity);
		return new CommonResult(ResultConstant.SUCCCSS_CODE, ResultConstant.SUCCESS_MSG);
	}

	/**
	 * 添加
	 *
	 * @return
	 */
	@RequestMapping(value = "/add", method = RequestMethod.POST)
	public CommonResult add(@RequestBody SalaryEntity entity) {
		service.add(entity);
		return new CommonResult(ResultConstant.SUCCCSS_CODE, ResultConstant.SUCCESS_MSG);
	}

	/**
	 * 删除
	 *
	 * @return
	 */
	@RequestMapping(value = "/delete", method = RequestMethod.POST)
	public CommonResult delete(@RequestBody SalaryEntity entity) {
		service.delete(entity);
		return new CommonResult(ResultConstant.SUCCCSS_CODE, ResultConstant.SUCCESS_MSG);
	}

}
